/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ats.ereg.model.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Past;

import org.hibernate.validator.constraints.NotEmpty;

/**
 *
 * @author Ali
 */
@Entity
@Table(name = "tst_students")
@NamedQueries({
    @NamedQuery(name = "TstStudents.findAll", query = "SELECT t FROM TstStudents t")})
public class TstStudents implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "student_id")
    @NotEmpty
    private String studentId;
    @Temporal(TemporalType.DATE)
    @Past
    private Date dob;
    @Basic(optional = false)
    @Column(name = "first_name")
    @NotEmpty
    private String firstName;
    @Basic(optional = false)
    @Column(name = "father_name")
    @NotEmpty
    private String fatherName;
    @Column(name = "grand_father_name")
    private String grandFatherName;
    @Basic(optional = false)
    @Column(name = "family_name")
    @NotEmpty
    private String familyName;
    @Column(name = "mother_name")
    private String motherName;
    private String picture;
    @Column(name = "create_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createDate;
    @Column(name = "update_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date updateDate;
    @JoinColumn(name = "updated_by", referencedColumnName = "id")
    @ManyToOne
    private TstUsers updatedBy;
    @JoinColumn(name = "created_by", referencedColumnName = "id")
    @ManyToOne
    private TstUsers createdBy;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tstStudents")
    private List<TstStdCourses> tstStdCoursesList;

    public TstStudents() {
    }

    public TstStudents(Integer id) {
        this.id = id;
    }

    public TstStudents(Integer id, String studentId, String firstName, String fatherName, String familyName) {
        this.id = id;
        this.studentId = studentId;
        this.firstName = firstName;
        this.fatherName = fatherName;
        this.familyName = familyName;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getStudentId() {
        return studentId;
    }

    public void setStudentId(String studentId) {
        this.studentId = studentId;
    }

    public Date getDob() {
        return dob;
    }

    public void setDob(Date dob) {
        this.dob = dob;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getFatherName() {
        return fatherName;
    }

    public void setFatherName(String fatherName) {
        this.fatherName = fatherName;
    }

    public String getGrandFatherName() {
        return grandFatherName;
    }

    public void setGrandFatherName(String grandFatherName) {
        this.grandFatherName = grandFatherName;
    }

    public String getFamilyName() {
        return familyName;
    }

    public void setFamilyName(String familyName) {
        this.familyName = familyName;
    }

    public String getMotherName() {
        return motherName;
    }

    public void setMotherName(String motherName) {
        this.motherName = motherName;
    }

    public String getPicture() {
        return picture;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public TstUsers getUpdatedBy() {
        return updatedBy;
    }

    public void setUpdatedBy(TstUsers updatedBy) {
        this.updatedBy = updatedBy;
    }

    public TstUsers getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(TstUsers createdBy) {
        this.createdBy = createdBy;
    }

    public List<TstStdCourses> getTstStdCoursesList() {
        return tstStdCoursesList;
    }

    public void setTstStdCoursesList(List<TstStdCourses> tstStdCoursesList) {
        this.tstStdCoursesList = tstStdCoursesList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TstStudents)) {
            return false;
        }
        TstStudents other = (TstStudents) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ats.ereg.model.entities.TstStudents[ id=" + id + " ]";
    }
    
}
